package io;

import java.io.File;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/*

 */
public class TestNote {
    public static void main(String[] args) throws IOException {
        File file=new File("note.txt");
        FileOutputStream fos=new FileOutputStream(file);
        Scanner scan =new Scanner(System.in);
        while(true){
            System.out.println("请输入要做的事,输入exit退出");
            String line=scan.nextLine();
            byte[] data=line.getBytes(StandardCharsets.UTF_8);
            if(line.equals("exit")) {
                break;
            }else{
                fos.write(data);
                System.out.println("已写入记事本");
            }
        }
        System.out.println("程序已退出");
        fos.close();
    }
}
